<?php
/*
 * Template Name: Process Room Bookings
 */
get_header();

?>

    <div id="content" class="site-content" style="padding-top: 0px;">

        <div id="primary" class="content-area container">
            <main id="main" class="site-main full-width" role="main">


                <article id="post-2" class="post-2 page type-page status-publish hentry">

                    <div class="entry-content">

						<?php
						$book_query = get_transient('room_booking_result');
						if ($book_query):
							echo '<pre id="result">';
							print_r($book_query);
							echo '</pre>';
							echo '<button onclick="copyToClipboard()" id="copy-button" style="margin-right:10px;">点击复制</button>';
						else:
                            if(isset($_GET["action"]) && $_GET["action"] === "submitbookings"):?>
                                <form action="/" method="post">
                                    <textarea name="booking_json" id="booking_json" cols="30" rows="10" placeholder="输入fetch全部预定情况的反馈json"></textarea>
		                            <?php wp_nonce_field('process_room_booking_json', 'room_booking_json_nonce'); ?>
                                    <input type="submit" value="提交预定">
                                </form>
                            <?php else:?>
                            <form action="/" method="post">
                                <textarea name="csrf_token" id="csrf_token" cols="30" rows="10" placeholder="输入csrf令牌"></textarea>
								<?php wp_nonce_field('process_room_booking', 'room_booking_nonce'); ?>
                                <input type="submit" value="提交" id="form_submit">
                            </form>
                            <?php endif;?>

						<?php endif;?>

                    </div><!-- .entry-content -->

                </article><!-- #post-## -->

            </main><!-- #main -->

        </div><!-- #primary -->


    </div>


<?php
get_footer();